package com.gitee.wsl.func

/*****************************************************************************
 * ------------------------------------------------------------------------- *
 * Licensed under the Apache License, Version 2.0 (the "License");           *
 * you may not use this file except in compliance with the License.          *
 * You may obtain a copy of the License at                                   *
 *                                                                           *
 * http://www.apache.org/licenses/LICENSE-2.0                                *
 *                                                                           *
 * Unless required by applicable law or agreed to in writing, software       *
 * distributed under the License is distributed on an "AS IS" BASIS,         *
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  *
 * See the License for the specific language governing permissions and       *
 * limitations under the License.                                            *
 *****************************************************************************/
//import android.hardware.biometrics.BiometricManager.Strings
//import com.gitee.wsl.struct.template.Substring
/*import java.util.Objects
import java.util.Func.BiConsumer
import java.util.Func.BiPredicate
import java.util.Func.Func
import java.util.Func.Supplier*/


fun interface BiFunction<T, U, R> {
    /**
     * Applies this Func to the given arguments.
     *
     * @param t the first Func argument
     * @param u the second Func argument
     * @return the Func result
     */
    fun apply(t: T, u: U): R

    operator fun invoke(t: T, u: U): R = apply(t,u)

    /**
     * Returns a composed Func that first applies this Func to
     * its input, and then applies the `after` Func to the result.
     * If evaluation of either Func throws an exception, it is relayed to
     * the caller of the composed Func.
     *
     * @param <V> the type of output of the `after` Func, and of the
     * composed Func
     * @param after the Func to apply after this Func is applied
     * @return a composed Func that first applies this Func and then
     * applies the `after` Func
     * @throws NullPointerException if after is null
    </V> */
    fun <V> andThen(after: Function<in R, out V>): BiFunction<T, U, V> {
        return BiFunction{ t: T, u: U ->
            after.apply(apply(t, u))
        }
    }
}